<template>
	<wd-navbar title="操作权限管理" :bordered="false" placeholder safeAreaInsetTop right-text="添加" left-arrow
		@click-left="handleBack" @click-right="clickHeaderRight">
	</wd-navbar>
	
	<view class="action-list ">
		<view class="action-list-li" v-for="(li,index) in data.list ">
			{{li.name}}
		</view>
	</view>
	
</template>

<script setup>
	import overallRequest from "@/utool/http/http.js"
	import {
		reactive,
		ref,
		toRaw
	} from "vue"
	import {
		onReady,
		onReachBottom
	} from "@dcloudio/uni-app"

	const data = reactive({
		page: null,
		pages: null,
		limit: null,
		total:null,
		list: []
	})
	
	// 滚动页面到底部
	onReachBottom(() => {
		let page = data.page
		let pages = data.pages
		if (page >= pages) {
			return
		} else {
			data.page++
			GetList()
		}
	})

	// 点击返回
	function handleBack() {
		uni.navigateBack({})
	}

	// 获取列表数据
	function GetList() {
		let url = "/auth/actionList"
		overallRequest(url).then(res => {
			console.log(res);
			let {page,pages,limit,list,total} = res.data
			data.page = page 
			data.pages=pages 
			data.limit =limit 
			data.list.push(...list)
			data.total = total
		}).catch(err => {
			console.log(err);
		})
	}
	onReady(() => {
		GetList()
	})
</script>

<style>

</style>